package com.shouer.doc.ui.videocall.presenter;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.shouer.doc.common.util.DateFormatUtil;
import com.shouer.doc.request.GsonRequest;
import com.shouer.doc.request.RequestUtil;
import com.shouer.doc.ui.videocall.response.ProcessOrderResponse;
import com.shouer.doc.ui.videocall.view.IShouerVideoView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yangyayun on 2017/2/7.
 */

public class ShouerVideoPresenterCompl implements IShouerVideoPresenter{


    private IShouerVideoView videoView;

    public ShouerVideoPresenterCompl(IShouerVideoView videoView)
    {
        this.videoView=videoView;
    }



    @Override
    public void processOrder(String orderId, String patId, String docId, String startTime, String endTime,String consultSecond) {

        Map<String, String> param = new HashMap<>();
        param.put("orderId", orderId);
        param.put("patId", patId);
        param.put("docId",docId);
        param.put("startTime",DateFormatUtil.longToString(Long.valueOf(startTime),"yyyy-MM-dd HH:mm:ss"));
        param.put("endTime", DateFormatUtil.longToString(Long.valueOf(endTime),"yyyy-MM-dd HH:mm:ss"));
        param.put("consultSecond", consultSecond);

        final GsonRequest<ProcessOrderResponse> request = new GsonRequest("processOrder", ProcessOrderResponse.class, new Response.Listener<ProcessOrderResponse>() {
            @Override
            public void onResponse(ProcessOrderResponse response) {
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });

        RequestUtil.sendRequest(videoView.getContext(), param, request);
    }

    @Override
    public void onDestroy() {

    }
}
